//
//  CategoryCell.m
//  IntimateGift
//
//  Created by 张科 on 14-12-20.
//  Copyright (c) 2014年 蔡宏业. All rights reserved.
//

#import "CategoryCell.h"
@implementation CategoryCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //定义一个imageView
        self.cover_image = [[UIImageView alloc] init];
        [self.contentView addSubview:self.cover_image];
        [_cover_image release];
        self.title = [[UILabel alloc] init];
        [self.contentView addSubview:self.title];
        self.title.font = [UIFont boldSystemFontOfSize:25];
        self.title.numberOfLines  = 0;
        self.title.textColor = [UIColor whiteColor];
        self.title.textAlignment = NSTextAlignmentCenter;
        [_title release];
        self.likes_count = [[UILabel alloc] init];
        [self.contentView addSubview:self.likes_count];
        self.likes_count.textColor = [UIColor whiteColor];
        self.likes_count.textAlignment = NSTextAlignmentCenter;
        self.likes_count.backgroundColor = [UIColor clearColor];
        self.likes_count.backgroundColor = [UIColor blackColor];
        [_likes_count release];
        [self layoutSubviews];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    _title.frame = CGRectMake(0, 100, self.contentView.bounds.size.width , 60);
    _cover_image.frame = CGRectMake(10, 10, self.contentView.bounds.size.width - 15, self.contentView.bounds.size.height - 15);
    _likes_count.frame = CGRectMake(self.contentView.bounds.size.width - 80, 40, 60, 40);
    
}
- (void)dealloc
{
    [_title release];
    [_cover_image release];
    [_likes_count release];
    [super dealloc];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
